home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / WorldScript.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  8.9 KB  |  340 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        WorldScript.p
  3.  
  4.      Contains:    WorldScript I Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT WorldScript;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __WORLDSCRIPT__}
  27. {$SETC __WORLDSCRIPT__ := 1}
  28.  
  29. {$I+}
  30. {$SETC WorldScriptIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __TRAPS__}
  37. {$I Traps.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __QUICKDRAWTEXT__}
  40. {$I QuickdrawText.p}
  41. {$ENDC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49. TYPE
  50.     WSIOffset                            = UInt16;
  51.     WSIByteCount                        = UInt8;
  52.     WSIByteIndex                        = UInt8;
  53. { offset from start of sub-table to row in state table }
  54.     WSIStateOffset                        = UInt16;
  55.     WSITableOffset                        = UInt32;
  56.     WSISubtableOffset                    = UInt16;
  57.     WSIGlyphcode                        = UInt16;
  58.     WSITableIdentifiers                    = UInt32;
  59.  
  60. CONST
  61.     kScriptSettingsTag            = 'info';
  62.     kMetamorphosisTag            = 'mort';
  63.     kGlyphExpansionTag            = 'g2g#';
  64.     kPropertiesTag                = 'prop';
  65.     kJustificationTag            = 'kash';
  66.     kCharToGlyphTag                = 'cmap';
  67.     kGlyphToCharTag                = 'pamc';
  68.     kFindScriptRunTag            = 'fstb';
  69.  
  70.  
  71.  
  72. {***             L O O K U P    T A B L E    T Y P E S        ***}
  73.     WSILookupSimpleArray        = 0;                            {  a simple array indexed by glyph code  }
  74.     WSILookupSegmentSingle        = 2;                            {  segment mapping to single value  }
  75.     WSILookupSegmentArray        = 4;                            {  segment mapping to lookup array  }
  76.     WSILookupSingleTable        = 6;                            {  sorted list of glyph, value pairs  }
  77.     WSILookupTrimmedArray        = 8;                            {  a simple trimmed array indexed by glyph code  }
  78.  
  79.  
  80. TYPE
  81.     WSILookupTableFormat                = UInt16;
  82.     WSILookupValue                        = UInt16;
  83. { An offset from the beginning of the lookup table }
  84.     WSILookupOffset                        = UInt16;
  85. {    FORMAT SPECIFIC DEFINITIONS }
  86. {
  87.         lookupSimpleArray:
  88.         
  89.         This is a simple array which maps all glyphs in the font
  90.         to lookup values.
  91.     }
  92.     WSILookupArrayHeaderPtr = ^WSILookupArrayHeader;
  93.     WSILookupArrayHeader = RECORD
  94.         lookupValues:            ARRAY [0..0] OF WSILookupValue;            {  The array of values indexed by glyph code  }
  95.     END;
  96.  
  97. {
  98.         lookupTrimmedArray:
  99.         
  100.         This is a single trimmed array which maps a single range
  101.         of glyhs in the font to lookup values.
  102.     }
  103.     WSILookupTrimmedArrayHeaderPtr = ^WSILookupTrimmedArrayHeader;
  104.     WSILookupTrimmedArrayHeader = RECORD
  105.         firstGlyph:                WSIGlyphcode;
  106.         limitGlyph:                WSIGlyphcode;
  107.         valueArray:                ARRAY [0..0] OF WSILookupValue;
  108.     END;
  109.  
  110. { The format specific part of the subtable header }
  111.     WSILookupFormatSpecificHeaderPtr = ^WSILookupFormatSpecificHeader;
  112.     WSILookupFormatSpecificHeader = RECORD
  113.         CASE INTEGER OF
  114.         0: (
  115.             simpleArray:        WSILookupArrayHeader;                    {  rename lookupArray as simpleArray <9>  }
  116.             );
  117.         1: (
  118.             trimmedArray:        WSILookupTrimmedArrayHeader;
  119.             );
  120.     END;
  121.  
  122. { The overall subtable header }
  123.     WSILookupTableHeaderPtr = ^WSILookupTableHeader;
  124.     WSILookupTableHeader = RECORD
  125.         format:                    WSILookupTableFormat;                    {  table format  }
  126.         fsHeader:                WSILookupFormatSpecificHeader;            {  format specific header  }
  127.     END;
  128.  
  129.  
  130. {***        G L Y P H    E X P A N S I O N    ***}
  131.  
  132. CONST
  133.                                                                 {  fixed 1.0  }
  134.     kCurrentGlyphExpansionVersion = $00010000;
  135.  
  136.  
  137. TYPE
  138.     GlyphExpansionFormats                = UInt16;
  139.  
  140. CONST
  141.     GlyphExpansionLookupFormat    = 1;
  142.     GlyphExpansionContextualFormat = 2;
  143.  
  144.  
  145. TYPE
  146.     ExpandedGlyphClusterPtr = ^ExpandedGlyphCluster;
  147.     ExpandedGlyphCluster = PACKED RECORD
  148.         numGlyphs:                WSIByteCount;
  149.         bestGlyph:                WSIByteIndex;
  150.         glyphs:                    ARRAY [0..0] OF WSIGlyphcode;
  151.     END;
  152.  
  153.     ExpandedGlyphOffsetPtr = ^ExpandedGlyphOffset;
  154.     ExpandedGlyphOffset = RECORD
  155.         glyph:                    WSIGlyphcode;
  156.         offset:                    WSIOffset;                                {  offset to ExpandedGlyphCluster  }
  157.     END;
  158.  
  159.     GlyphExpansionStateTablePtr = ^GlyphExpansionStateTable;
  160.     GlyphExpansionStateTable = RECORD
  161.         stateTableOffset:        WSISubtableOffset;
  162.         classTableOffset:        WSISubtableOffset;
  163.         actionTableOffset:        WSISubtableOffset;                        {  state, class and actions tables follow here...  }
  164.     END;
  165.  
  166.     GlyphExpansionTablePtr = ^GlyphExpansionTable;
  167.     GlyphExpansionTable = RECORD
  168.         version:                Fixed;
  169.         format:                    INTEGER;
  170.         expansionNumer:            INTEGER;
  171.         expansionDenom:            INTEGER;                                {  num/denom ratio for expansion <2>  }
  172.         CASE INTEGER OF
  173.         0: (
  174.             stateTable:            GlyphExpansionStateTable;
  175.             );
  176.         1: (
  177.             lookup:                WSILookupTableHeader;                    {  expanded glyph clusters follow here...  }
  178.             );
  179.     END;
  180.  
  181.  
  182. { Glyph-to-Character constants and types  }
  183.  
  184. CONST
  185.     kCurrentGlyphToCharVersion    = $00010100;
  186.  
  187.  
  188. TYPE
  189.     GlyphToCharLookupFormats            = UInt16;
  190.  
  191. CONST
  192.     kGlyphToCharLookup8Format    = 1;
  193.     kGlyphToCharLookup16Format    = 2;
  194.     kGlyphToCharLookup32Format    = 3;
  195.  
  196.  
  197. TYPE
  198.     GlyphToCharFontIndex                = UInt8;
  199.     QDGlyphcode                            = UInt8;
  200.     GlyphToCharActionTablePtr = ^GlyphToCharActionTable;
  201.     GlyphToCharActionTable = RECORD
  202.         fontNameOffset:            WSISubtableOffset;                        {  offset relative to this table  }
  203.         actions:                WSILookupTableHeader;                    {  only support lookupSimpleArray format for now  }
  204.     END;
  205.  
  206.     GlyphToCharActionHeaderPtr = ^GlyphToCharActionHeader;
  207.     GlyphToCharActionHeader = RECORD
  208.         numTables:                INTEGER;                                {  0..n  }
  209.         offsets:                ARRAY [0..0] OF WSISubtableOffset;        {  offsets from start of action table header  }
  210.     END;
  211.  
  212.     GlyphToCharHeaderPtr = ^GlyphToCharHeader;
  213.     GlyphToCharHeader = RECORD
  214.         version:                Fixed;
  215.         actionOffset:            WSISubtableOffset;                        {  offset to GlyphToCharActionHeader  }
  216.         format:                    INTEGER;                                {  size of font mask  }
  217.         mappingTable:            WSILookupTableHeader;
  218.     END;
  219.  
  220.  
  221. { JUSTIFICATION TYPES
  222.     WorldScript supports justification of text using insertion. The justification
  223.     table specifies a insertion string to insert between 2 specified glyphs.
  224.     Each combination of inter-glyph boundary can be assigned a justification priority,
  225.     the higher the priority the more justification strings inserted at that position.
  226.     
  227.     The priorities for each inter-glyph boundary are specified by the justification table's
  228.     state table.
  229.     
  230.     Special handling is done for scripts which use spaces to justify, because the width of 
  231.     a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  232.     per inserting string is specified in the justification table.
  233.  
  234. }
  235.  
  236. CONST
  237.                                                                 {  1.0 not supported  }
  238.     kCurrentJustificationVersion = $0200;
  239.  
  240.     kJustificationStateTableFormat = 1;
  241.  
  242.                                                                 {  WSI's internal limitation <12>  }
  243.     kMaxJustificationStringLength = 13;
  244.  
  245.  
  246. TYPE
  247.     WSIJustificationPriority            = UInt8;
  248.  
  249. CONST
  250.     WSIJustificationSetMarkMask    = $80;
  251.  
  252.  
  253. TYPE
  254.     WSIJustificationStateEntryPtr = ^WSIJustificationStateEntry;
  255.     WSIJustificationStateEntry = PACKED RECORD
  256.         markPriority:            WSIJustificationPriority;                {  non-zero priorities means insertion  }
  257.         priority:                WSIJustificationPriority;
  258.         newState:                WSIStateOffset;
  259.     END;
  260.  
  261.     WSIJustificationClasses                = UInt16;
  262.  
  263. CONST
  264.     wsiJustEndOfLineClass        = 0;
  265.     wsiJustEndOfRunClass        = 1;
  266.     wsiJustDeletedGlyphClass    = 2;
  267.     wsiJustUserDefinedClass        = 3;
  268.  
  269.  
  270. TYPE
  271.     WSIJustificationStates                = UInt16;
  272.  
  273. CONST
  274.     wsiStartOfLineState            = 0;                            {  pre-defined states  }
  275.     wsiStartOfRunState            = 1;
  276.     wsiUserDefinedState            = 2;
  277.  
  278. { pre-multiplied: class# * sizeof(WSIJustificationStateEntry) }
  279.  
  280. TYPE
  281.     WSIJustificationClassOffset            = UInt8;
  282.     WSIJustificationStateTablePtr = ^WSIJustificationStateTable;
  283.     WSIJustificationStateTable = RECORD
  284.         maxPriorities:            INTEGER;
  285.         rowWidth:                UInt16;                                    {  width of a state table row in bytes  }
  286.         classTableOffset:        INTEGER;
  287.         stateTableOffset:        INTEGER;
  288.     END;
  289.  
  290. {
  291.             Last two fields of above structure - someday?
  292.             WSIJustificationClassOffset    classes[up to 64 classes supported];
  293.             WSIJustificationStateEntry    states[up to your heart's desire];
  294.         }
  295.     WSIJustificationHeaderPtr = ^WSIJustificationHeader;
  296.     WSIJustificationHeader = RECORD
  297.         version:                INTEGER;
  298.         format:                    INTEGER;
  299.         scaling:                Point;                                    {  numer/denom scaling of priority weights <7>  }
  300.         spacesPerInsertion:        UInt16;                                    {  # of $20 chars in justification insertion string <12>  }
  301.         justStringOffset:        UInt16;                                    {  offset to justification string  }
  302.         stateTable:                WSIJustificationStateTable;                {  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows  }
  303.     END;
  304.  
  305.  
  306. { Line Layout's Property table version <11> }
  307.  
  308. CONST
  309.                                                                 {  v1.0  }
  310.     currentPropsTableVersion    = $00010000;
  311.  
  312.                                                                 {  version is octal 0100 or hex 0x40 (#64)  }
  313.     kCharToGlyphCurrentVersion    = $40;
  314.  
  315. { pass as priorityWeight to JustifyWSILayout to use script's current just setting }
  316.     kScriptsDefaultJustWeight    = -1;
  317.  
  318.  
  319. { feature selectors used in FindScriptRun and itl5 configuration tables <9> }
  320.  
  321. TYPE
  322.     WSIFeatureType                        = UInt16;
  323.     WSIFeatureSelector                    = UInt16;
  324.     WSIFeaturePtr = ^WSIFeature;
  325.     WSIFeature = RECORD
  326.         featureType:            WSIFeatureType;
  327.         featureSelector:        WSIFeatureSelector;
  328.     END;
  329.  
  330. {$ALIGN RESET}
  331. {$POP}
  332.  
  333. {$SETC UsingIncludes := WorldScriptIncludes}
  334.  
  335. {$ENDC} {__WORLDSCRIPT__}
  336.  
  337. {$IFC NOT UsingIncludes}
  338.  END.
  339. {$ENDC}
  340.